home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / gfa / 4_jystks.lst next >
Encoding:
File List  |  1994-09-22  |  952 b   |  33 lines

  1. '
  2. ' Written in GFA Basic (3.5) code
  3. '
  4. ' Converted from STOS code to read the parallel port (with joystick adapter) by
  5. '  Richard Morris 23/sept/1994 9:10pm (Don't know who the original author was)
  6. ' e-mail: r.m.morris@massey.ac.nz  (probably only until around November 1994)
  7. '
  8. a%=XBIOS(28,0,7)        !Was 192 on my computer (1040STfm)
  9. b%=XBIOS(28,0,14)       !35
  10. c%=XBIOS(28,0,15)       !0
  11. CLS
  12. PRINT AT(1,1);"Press any key to exit"
  13. PRINT
  14. PRINT "Joystick 0","Joystick 1","Button 0","Button 1"
  15. REPEAT
  16.   read_stick
  17.   PRINT AT(1,4);j0%,j1%,btn0%,btn1%,
  18. UNTIL INKEY$<>""
  19. ' must do this else can't read floppy drive
  20. ' not sure if values ever differ - so just return to the original values
  21. ~XBIOS(28,a%,128+7)
  22. ~XBIOS(28,b%,128+14)
  23. ~XBIOS(28,c%,128+15)
  24. > PROCEDURE read_stick
  25.   ~XBIOS(28,0,128+7)
  26.   j0%=XBIOS(28,0,128+15)
  27.   j1%=AND(j0%,&HF0)
  28.   j1%=ROR(j1%,4)
  29.   j0%=AND(&HF,j0%)
  30.   btn0%=NOT BTST(XBIOS(28,0,128+14),5)
  31.   btn1%=NOT BTST(PEEK(&HFFFA01),0)
  32. RETURN
  33.